<%-- 
    Document   : AddNumber
    Created on : Apr 7, 2014, 11:47:31 AM
    Author     : mishra
--%>

<%@page import="ExamType.ExamTypeBean"%>
<%@page import="Course.CourseList"%>
<%@page import="Course.CourseBean"%>
<%
    try {
        if (session.getAttribute("uid") != null) {
            if (session.getAttribute("Manage_Examination").toString().equals("1")) {
%>
<%String to = "", status = "", msg = "";%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>Ramgovind Automated System</title>

        <link rel="stylesheet" href="/RIT/css/bootstrap.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="/RIT/css/jquery.fancybox.css">
        <link rel="stylesheet" href="/RIT/css/style.css">
        <link rel="stylesheet" href="/RIT/css/iconfont.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap.datepicker.css">
        <script src="../../ajax/ajax.js"></script>
        <script>
            function cal(inp, i, out, subtotal) {
                var total = 0;
                for (var j = 0; j < i; j++) {

                    var val = parseFloat(document.getElementById(inp + j).value);
                    //alert(isNaN(val));
                    if (!isNaN(val)) {
                        var whtage = parseFloat(document.getElementById(inp + j).title);
                        total = total + ((parseFloat(val) / parseFloat(subtotal)) * parseFloat(whtage));
                    }
                    document.getElementById(out).value = total;
                }
            }
        </script>
    </head>
    <body>
        <%@include file="/topheader.html" %>
        <%@include file="/servicesheader.html" %>
        <div class="main">
            <div class="container-fluid">
                <%@include file="/Services/Examination/examsidenav.html" %>
                <div class="content">
                    <%if (session.getAttribute("status") != null) {
                            status = session.getAttribute("status").toString();
                            msg = session.getAttribute("msg").toString();
                    %>
                    <div class="alert alert-info alert-block">
                        <a class="close" data-dismiss="alert" href="#"><img src="/RIT/img/mclose.png"></a>
                        <h4 class="alert-heading"> <%=status%></h4>
                        <%=msg%>

                    </div>
                    <%session.removeAttribute("status");
                            session.removeAttribute("msg");
                        }%>
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="box">
                                <div class="box-head">
                                    <h3>Add Number</h3>
                                    <a href="MarksReport.jsp">
                                        <button style="float: right" class="btn btn-success">View Report Card</button>
                                    </a>
                                </div>
                                <form action="/RIT/AddMarks" method="post" class='validate form-horizontal'>
                                    <div class="box-content">
                                        <!---Form Start....-->

                                        <div id="lside" style="float: left; margin-top: 10px;">
                                            <div class="control-group">
                                                <label for="course" class="control-label">Course<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select name="course" id="course" class='{required:true}'onchange="getStream('stream', this.value)">
                                                        <option value=''>Select Course</option>
                                                        <%
                                                            Vector<Object> list = Course.Query.viewAlldistinct();
                                                            Iterator it = list.iterator();
                                                            while (it.hasNext()) {
                                                                CourseBean cb = (CourseBean) it.next();
                                                        %>
                                                        <option value="<%=cb.getCourseName()%>"><%=cb.getCourseName()%></option>
                                                        <%}%>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="stream" class="control-label">Stream<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select name="stream" id="stream" class='{required:true}' onchange="getSemester('course', this.options[this.selectedIndex].text)">
                                                        <option value="">Select Stream</option>
                                                    </select>
                                                </div>
                                            </div>    

                                        </div>
                                        <div id="rside" style="float: right; margin-right: 120px; margin-top: 10px">

                                            <div class="control-group">
                                                <label for="stream" class="control-label">Semester<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select name="semester" id="semester" class='{required:true}' onchange="getSubject(document.getElementById('stream').options[document.getElementById('stream').selectedIndex].text, this.value)">
                                                        <option value="">Select Semester</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="subject" class="control-label">Subject<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select name="subject" id="subject" class='{required:true}' onchange="getStuList(document.getElementById('stream').value, document.getElementById('semester').value, this.value)">

                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="box-content box-nomargin">
                                            <table class='table table-striped dataTable-noheader dataTable-nofooter table-bordered' id="ct">
                                                <thead>
                                                    <tr>
                                                        <th>Name</th>
                                                        <th>Roll No.</th>
                                                            <%{
                                                                    Vector list1 = (Vector) ExamType.Query.viewAll();
                                                                    Iterator it1 = list1.iterator();
                                                                    while (it1.hasNext()) {
                                                                        ExamTypeBean etb = (ExamTypeBean) it1.next();
                                                            %>
                                                        <th><%=etb.getExamTypeName()%> (Weightage = <%=etb.getWeightage()%> %)</th>
                                                            <%}
                                                                }
                                                            %>
                                                        <th>Total</th>
                                                    </tr>

                                                </thead>
                                                <tbody id="tbody">

                                                </tbody>
                                            </table>
                                        </div>           
                                        <!---Form Ends....-->
                                    </div>
                                    <div class="form-actions">
                                        <input type="submit" class='btn btn-primary'value="update">
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>	
            </div>
        </div>
        <script src="/RIT/js/jquery.js"></script>
        <script src="/RIT/js/less.js"></script>
        <script src="/RIT/js/bootstrap.min.js"></script>
        <script src="/RIT/js/jquery.uniform.min.js"></script>
        <script src="/RIT/js/bootstrap.timepicker.js"></script>
        <script src="/RIT/js/bootstrap.datepicker.js"></script>
        <script src="/RIT/js/chosen.jquery.min.js"></script>
        <script src="/RIT/js/jquery.fancybox.js"></script>
        <script src="/RIT/js/plupload/plupload.full.js"></script>
        <script src="/RIT/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
        <script src="/RIT/js/jquery.cleditor.min.js"></script>
        <script src="/RIT/js/jquery.inputmask.min.js"></script>
        <script src="/RIT/js/jquery.tagsinput.min.js"></script>
        <script src="/RIT/js/jquery.mousewheel.js"></script>
        <script src="/RIT/js/jquery.textareaCounter.plugin.js"></script>
        <script src="/RIT/js/ui.spinner.js"></script>
        <script src="/RIT/js/jquery.jgrowl_minimized.js"></script>
        <script src="/RIT/js/jquery.form.js"></script>
        <script src="/RIT/js/jquery.validate.min.js"></script>
        <script src="/RIT/js/bbq.js"></script>
        <script src="/RIT/js/jquery-ui-1.8.22.custom.min.js"></script>
        <script src="/RIT/js/jquery.form.wizard-min.js"></script>
        <script src="/RIT/js/jquery.cookie.js"></script>
        <script src="/RIT/js/jquery.metadata.js"></script>
        <script src="/RIT/js/custom.js"></script><script src="/RIT/js/demo.js"></script>
        <script src="/RIT/js/iconfont.js"></script>
    </body>
</html>

<%} else {
%>
<script type="text/javascript">
                                                        alert("You Are Not Authorised");
                                                        window.history.back();
</script>
<%             }
        } else {
            request.setAttribute("msg", "You Are Not Authorised! Please Contact to System Administrator!");
            request.setAttribute("value", "0");
            getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
        }
    } catch (Exception e) {
        request.setAttribute("msg", "Please Contact to System Administrator!");
        request.setAttribute("value", "0");
        getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    }
%>

